]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
overviewControls: Bind state adjustment signals to parent lifetime
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Fri, 31 Oct 2025 03:57:50 +0000 (04:57 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 24 Nov 2025 13:42:59 +0000 (14:42 +0100)
On tests shutdown we were sometimes getting this error:

  ** Message: 09:29:27.494: Shutting down GNOME Shell

  (gnome-shell:3728700): Gjs-CRITICAL **: 09:29:27.545:
  JS ERROR: TypeError: this._workspacesDisplay is undefined
  _update@resource:///org/gnome/shell/ui/overviewControls.js:599:37
  _initializeUI/<@resource:///org/gnome/shell/ui/main.js:279:14

Which after using the arrow function becomes:

  (gnome-shell:3731979): Gjs-CRITICAL **: 09:30:05.419:
  JS ERROR: TypeError: this._workspacesDisplay is undefined
  _update@resource:///org/gnome/shell/ui/overviewControls.js:599:37
  _init/<@resource:///org/gnome/shell/ui/overviewControls.js:343:67
  _initializeUI/<@resource:///org/gnome/shell/ui/main.js:279:14

This is because the state adjustement object lifetime is not bound to
the ControlsManager, and so we were potentially accessing to invalid
data

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3943>
(cherry picked from commit 935c5a0c540237ea7d1b8e38141577ac20669662)

js/ui/overviewControls.js

index abeca3c571da6a36badf1d2f920e1c1f0145683c..bea078c2d4d3755b3f3d9e9c17c0038c4a65975b 100644 (file)
@@ -340,7 +340,8 @@ class ControlsManager extends St.Widget {
         this._workspaceAdjustment = Main.createWorkspacesAdjustment(this);
 
         this._stateAdjustment = new OverviewAdjustment(this);
-        this._stateAdjustment.connect('notify::value', this._update.bind(this));
+        this._stateAdjustment.connectObject('notify::value',
+            () => this._update(), this);
 
         this._searchController = new SearchController.SearchController(
             this._searchEntry,